<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
    </head>
    <body>
        <script>
            function * gen(args){
                
              let y1=  yield 111;
                console.log(y1);
               let y2 = yield 222;
               console.log(y2);
               let y3 = yield 333;
               console.log(y3);
                console.log(args);
            };
            let iterator = gen("AAA");
            //next传递的参数作为上一个yield的返回结果
            // console.log(iterator.next());
            console.log(iterator.next("BBB"));
            console.log(iterator.next("CCC"));
            console.log(iterator.next("DDD"));
        </script>
    </body>
</html>